
<div ng-controller="rebateRegCtrl">
	
<div ng-include="'/templates/paramsSelect.html'"></div>
	<div class="page-heading">
		<ul class="breadcrumb" >
			<li><a href="javascript:;">衍生业务</a></li>
			<li class="active" ng-hide="menuName">返利登记</li>
			<li class="active" ng-show="menuName" ng-bind="menuName">返利登记</li>
			<span style="margin-right:10px;"  class="btn btn-danger btn-xs pull-right btn-flag " ng-show="flag" ng-click="delFlag('/rebate/reg/')"><i class="fa fa-times"></i> 删除 </span>
			<span style="margin-right:10px;"  class="btn btn-info btn-xs pull-right btn-flag " ng-click="addFlag('#/rebate/reg/')"><i class="fa fa-star"></i> 收藏 </span>	
		</ul>
		
	</div>
	<!-- 页面头部  end-->

	<!--页面内容显示区域-->
	<div class="wrapper">


		<div class="row">
			<div class="col-sm-12">
				<!--表格显示区域-->
				<section class="panel">
					<!--区块头 显示表格名称和功能按钮-->
					<header class="panel-heading">
						返利登记信息列表
						<!--控制按钮-->
						<span class="tools pull-right"> <!--收起-->
							<button type="button" class="btn btn-success pull-left" ng-click="SearchData()"
								style="margin-left: 5px;">
								<i class="fa fa-search" ></i> 查询
							</button>
							<button type="button" class="btn btn-info  pull-left" ng-click="ExportData()"
								style="margin-left: 5px;">
								<i class="fa fa-table"></i> 导出EXCEL
							</button> <a href="javascript:;" class="fa fa-chevron-up form_display"></a>

						</span>
					</header>
					<!--区块body 显示表格内容-->
					<div class="panel-body form-horizontal form_hide">
						<div class="row">
							<div class="col-md-3 ">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label"
										for="inputEmail1">事业部</label>
										<div class="col-lg-8 col-sm-7">
										<input type="text" id="entity_group_name"  ng-keyup="clearGroup()" name="entity_group_name"   class="form-control select_edit form_params" />
                                            <ul class="select_list">
                                                  <li ng-repeat="e in groups" ng-click='LoadBrands(e.group_name)' val_code="{{e.group_name}}" val_name="{{e.group_name}}">{{e.group_name}}</li>
                                            </ul>  
                                            </div>
								</div>
							</div>
							
							<div class="col-md-3 ">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label"
										for="inputEmail1">店面品牌</label>
									<div class="col-lg-8 col-sm-7">
										<input type="text" id="entity_brand_name"  ng-keyup="clearGroupBrand()" name="entity_brand_name" class="form-control select_edit form_params" value=""/>
                                            <ul class="select_list">
                                                  <li ng-repeat="e in gBrands" ng-click='LoadEntitys(e)' val_code="{{e.brand_code}}" val_name="{{e.brand_name}}">{{e.brand_name}}</li>
                                            </ul> 
									</div>
								</div>
							</div>
							
							
							<div class="col-md-3 ">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label" for="inputEmail1">店面信息</label>
									<div class="col-lg-8 col-sm-7">
											<input type="text" id="entity_name" name="entity_name" class="form-control select_edit form_params" value=""/>
                                            <ul class="select_list">
                                                  <li ng-repeat="e in entitys" val_code="{{e.entity_code}}" val_name="{{e.entity_name}}">{{e.entity_name}}({{e.entity_code}})</li>
                                            </ul>  
									</div>
								</div>
							</div>
							
							
							<div class="col-md-3">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label"
										for="inputEmail1">业务部门</label>
									<div class="col-lg-8 col-sm-7">
									<input type="text" id="org_name" name="org_name" class="form-control select_edit form_params" value=""/>
                                            <ul class="select_list">
                                                  <li ng-repeat="b in departments"  val_code="{{b.org_name}}" val_name="{{b.org_name}}">{{b.org_name}}</li>
                                            </ul> 
									
									</div>
								</div>
							</div>
							
							<div class="col-md-3">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label"
										for="inputEmail1">返利单号</label>
									<div class="col-lg-8 col-sm-7">
										<input name="rebate_no" id="rebate_no" class="form-control form_params" />
									</div>
								</div>
							</div>
							
							<div class="col-md-3">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label"
										for="inputEmail1">单据状态</label>
									<div class="col-lg-8 col-sm-7">
										<select name="status"  class="form-control form_params">
											<option></option>
											<option ng-selected="b.status_code==selected.status" ng-repeat="b in status_list" value="{{b.status_code}}">{{b.status_desc}}</option>
										</select>
									</div>
								</div>
							</div>
							<div class="col-md-3">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label" for="inputEmail1">开票日期</label>
									<div class="col-lg-8 col-sm-7">
										<div data-date-format="yyyy-mm-dd" data-date="2016-5-15" class="input-large custom-date-range">
											<input type="text" name="invoice_date1" class="form-control form_params" id="invoice_date1"
												onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'invoice_date2\')||\'2020-10-01\'}'})">
										</div>
									</div>
								</div>
							</div>
							<div class="col-md-3">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label text-center" for="inputEmail1">至</label>
									<div class="col-lg-8 col-sm-7">
										<div data-date-format="yyyy-mm-dd" data-date="2016-5-15" class="input-large custom-date-range">
											 <input type="text" name="invoice_date2" class="form-control form_params" id="invoice_date2"
												onFocus="WdatePicker({minDate:'#F{$dp.$D(\'invoice_date1\')}',maxDate:'2020-10-01'})">
										</div>
									</div>
								</div>
							</div>
							<div class="col-md-3">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label" for="inputEmail1">返利日期</label>
									<div class="col-lg-8 col-sm-7">
										<div data-date-format="yyyy-mm-dd" data-date="2016-5-15" class="input-large custom-date-range">
											<input type="text" name="bounty_date1" class="form-control form_params" id="bounty_date1"
												onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'bounty_date2\')||\'2020-10-01\'}'})">
										</div>
									</div>
								</div>
							</div>
							<div class="col-md-3">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label text-center" for="inputEmail1">至</label>
									<div class="col-lg-8 col-sm-7">
										<div data-date-format="yyyy-mm-dd" data-date="2016-5-15" class="input-large custom-date-range">
											 <input type="text" name="bounty_date2" class="form-control form_params" id="bounty_date2"
												onFocus="WdatePicker({minDate:'#F{$dp.$D(\'bounty_date1\')}',maxDate:'2020-10-01'})">
										</div>
									</div>
								</div>
							</div>
							
							<div class="col-md-3">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label" for="inputEmail1">核销日期</label>
									<div class="col-lg-8 col-sm-7">
										<div data-date-format="yyyy-mm-dd" data-date="2016-5-15" class="input-large custom-date-range">
											<input type="text" name="writeoff_date1" class="form-control form_params" id="writeoff_date1"
												onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'writeoff_date2\')||\'2020-10-01\'}'})">
										</div>
									</div>
								</div>
							</div>
							<div class="col-md-3">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label text-center" for="inputEmail1">至</label>
									<div class="col-lg-8 col-sm-7">
										<div data-date-format="yyyy-mm-dd" data-date="2016-5-15" class="input-large custom-date-range">
											 <input type="text" name="writeoff_date2" class="form-control form_params" id="writeoff_date2"
												onFocus="WdatePicker({minDate:'#F{$dp.$D(\'writeoff_date1\')}',maxDate:'2020-10-01'})">
										</div>
									</div>
								</div>
							</div>
							
							<div class="col-md-3">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label" >结案日期</label>
									<div class="col-lg-8 col-sm-7">
										<div data-date-format="yyyy-mm-dd"  class="input-large custom-date-range">
											<input type="text" name="close_time1" class="form-control form_params" id="close_time1"
												onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'close_time2\')||\'2020-10-01\'}'})">
										</div>
									</div>
								</div>
							</div>
							<div class="col-md-3">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label text-center" >至</label>
									<div class="col-lg-8 col-sm-7">
										<div data-date-format="yyyy-mm-dd" data-date="2016-5-15" class="input-large custom-date-range">
											 <input type="text" name="close_time2" class="form-control form_params" id="close_time2"
												onFocus="WdatePicker({minDate:'#F{$dp.$D(\'close_time1\')}',maxDate:'2020-10-01'})">
										</div>
									</div>
								</div>
							</div>
							
							
							<div class="col-md-3">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label"
										for="inputEmail1">业务类型</label>
									<div class="col-lg-8 col-sm-7">
										<select name="serialapply_code"   class="form-control form_params">
											<option></option>
											<!-- <option ng-selected="b.serialapply_code==selected.serialapply_code" ng-repeat="b in types" value="{{b.serialapply_code}}">{{b.serialapply_name}}</option> -->
											<option value="9001">销售佣金</option>
											<option value="9002">新车保险返利</option>
											<option value="9003">按揭返利</option>
											<option value="9004">续保返利</option>
											<option value="9005">售后佣金</option>
											<option value="9006,9007">其他类型</option>
										</select>
									</div>
								</div>
							</div>
							<div class="col-md-3">
								<div class="form-group">
									<label class="col-lg-4 col-sm-5 control-label"
										for="inputEmail1">返利类型</label>
									<div class="col-lg-8 col-sm-7">
										<select name="business_type"   class="form-control form_params">
											<option></option>
											<option ng-selected="b.status_code==selected.business_type" ng-repeat="b in btypes" value="{{b.status_code}}">{{b.status_desc}}</option>
										</select>
									</div>
								</div>
							</div>
						



						</div>
					</div>
				</section>

				<section class="panel">
					<!--区块头 显示表格名称和功能按钮-->
					<header class="panel-heading">
						返利登记信息
						<headshow></headshow>
						<div class="option_check_list" style="display: inline-block;"></div>

						<!--控制按钮-->
						<span class="tools pull-right"> <!--收起--> <a
							href="javascript:;" class="fa fa-chevron-down"></a>
						</span>
						<div class="pull-right"
							style="margin-right: 10px; margin-top: -6px; display: inline-block">
							<button type="button" class="btn btn-danger btn-sm " href="#paramsSelect"
								data-toggle="modal">
								<i class="fa fa-plus"></i> 在结果集中筛选
							</button>
							<button type="button" class="btn btn-success btn-sm"
								id="search_table" ng-click="SearchData();">
								<i class="fa fa-search"></i> 查询表格
							</button>
						</div>
					</header>
					<!--区块body 显示表格内容-->
					<div class="panel-body form-horizontal ">

						<div class="adv-table" style="overflow-x: scroll">
							<table id="rebateRegTable"
								class="table table-striped  nowrap  dataTable no-footer table_store table-hover float_head"
								cellspacing="0" width="100%">
								<thead>
									<tr>
										<th ng-show="!cols.contains('index')" column="index">序号</th>
										<th ng-show="!cols.contains('option')" column="option">明细</th>
										<th ng-show="!cols.contains('entity_code')" column="entity_code">店面编号</th>
										<th ng-show="!cols.contains('entity_name')" column="entity_name">店面名称</th>
										<th ng-show="!cols.contains('entity_brand_name')" column="entity_brand_name">店面品牌</th>
										<th ng-show="!cols.contains('entity_group_name')" column="entity_group_name">事业部</th>
										<th ng-show="!cols.contains('rebate_no')" column="rebate_no">返利单号</th>
										<th ng-show="!cols.contains('business_type_name')" column="business_type_name">返利类型</th>
										<th ng-show="!cols.contains('object_type_name')" column="object_type_name">返利对象类型</th>
										<th qtype='double' ng-show="!cols.contains('predict_rebate_amount')" column="predict_rebate_amount">预计返利总额</th>
										<th qtype='double' ng-show="!cols.contains('actual_rebate_amount')" column="actual_rebate_amount">实际返利总额</th>
										<th qtype='double' ng-show="!cols.contains('actual_rebate_amount_notax')" column="actual_rebate_amount_notax">不含税金额</th>
										<th qtype='double' ng-show="!cols.contains('tax')" column="tax">税率</th>
										<th qtype='double' ng-show="!cols.contains('sales_rebate_no_tax')" column=sales_rebate_no_tax>冲抵销售返利(不含税)</th>
										<th qtype='double' ng-show="!cols.contains('sales_rebate_include_tax')" column="sales_rebate_include_tax">冲抵销售返利(含税)</th>
										<th qtype='date' ng-show="!cols.contains('bounty_date')" column="bounty_date">返利日期</th>
										<th qtype='date' ng-show="!cols.contains('invoice_date')" column="invoice_date">开票日期</th>
										<th qtype='date' ng-show="!cols.contains('writeoff_date')" column="writeoff_date">核销日期</th>
										<th qtype='date' ng-show="!cols.contains('close_time')" column="close_time">结案日期</th>
										<th ng-show="!cols.contains('invoice_maker')" column="invoice_maker">开票人</th>
										<th ng-show="!cols.contains('user_name')" column="user_name">经手人</th>
										<th ng-show="!cols.contains('writeoff_by')" column="writeoff_by">核销人</th>
										<th ng-show="!cols.contains('serialapply_code')" column="serialapply_code">业务类型代码</th>
										<th ng-show="!cols.contains('serialapply_name')" column="serialapply_name">业务类型名称</th>
										<th ng-show="!cols.contains('org_name')" column="org_name">业务发生部门</th>
										<th ng-show="!cols.contains('status_name')" column="status_name">单据状态</th>
										<th ng-show="!cols.contains('bill_no')" column="bill_no">票据号码</th>
										<th ng-show="!cols.contains('serialapply_object_name')" column="serialapply_object_name">返利对象名称</th>
										<th ng-show="!cols.contains('bounty_desc')" column="bounty_desc">返利描述</th>
										<th ng-show="!cols.contains('remark')" column="remark">备注</th>
										
									</tr>
								</thead>
								<tbody>
									<tr ng-repeat="c in datas" ng-dblclick="showDetail(c.entity_code,c.rebate_no);">
										<td ng-show="!cols.contains('index')" >{{$index + 1 }}</td>
										<td ng-show="!cols.contains('option')" class=""><a href="javascript:" ng-click="showDetail(c.entity_code,c.rebate_no);" >明细</a></a></td>
										<td ng-show="!cols.contains('entity_code')" class="left" column="entity_code">{{c.entity_code}}</td>
										<td ng-show="!cols.contains('entity_name')" class="left" column="entity_name">{{c.entity_name}}</td>
										<td ng-show="!cols.contains('entity_brand_name')" class="left" column="entity_brand_name">{{c.entity_brand_name}}</td>
										<td ng-show="!cols.contains('entity_group_name')" class="left" column="entity_group_name">{{c.entity_group_name}}</td>
										<td ng-show="!cols.contains('rebate_no')" class="">{{c.rebate_no}}</td>
										<td ng-show="!cols.contains('business_type_name')" class="">{{c.business_type_name}}</td>
										<td ng-show="!cols.contains('object_type_name')" class="">{{c.object_type_name}}</td>
										<td ng-show="!cols.contains('predict_rebate_amount')" class="right">{{c.predict_rebate_amount | number:2}}</td>
										<td ng-show="!cols.contains('actual_rebate_amount')" class="right">{{c.actual_rebate_amount | number:2}}</td>
										
										<td ng-show="!cols.contains('actual_rebate_amount_notax')" class="right">{{c.actual_rebate_amount_notax | number:2}}</td>
										<td ng-show="!cols.contains('tax')" class="right">{{c.tax | number:2}}</td>
										
										<td ng-show="!cols.contains('sales_rebate_no_tax')" class="right">{{c.sales_rebate_no_tax | number:2}}</td>
										<td ng-show="!cols.contains('sales_rebate_include_tax')" class="right">{{c.sales_rebate_include_tax | number:2}}</td>
										<td ng-show="!cols.contains('bounty_date')" class="left">{{c.bounty_date  | date : 'yyyy-MM-dd'}}</td>
										<td ng-show="!cols.contains('invoice_date')" class="left">{{c.invoice_date  | date : 'yyyy-MM-dd'}}</td>
										<td ng-show="!cols.contains('writeoff_date')" class="left">{{c.writeoff_date  | date : 'yyyy-MM-dd'}}</td>
										<td ng-show="!cols.contains('close_time')" class="left">{{c.close_time  | date : 'yyyy-MM-dd'}}</td>
										<td ng-show="!cols.contains('invoice_maker')" class="">{{c.invoice_maker}}</td>
										<td ng-show="!cols.contains('user_name')" class="">{{c.user_name}}</td>
										<td ng-show="!cols.contains('writeoff_by')" class="">{{c.writeoff_by}}</td>
										<td ng-show="!cols.contains('serialapply_code')" class="">{{c.serialapply_code}}</td>
										<td ng-show="!cols.contains('serialapply_name')" class="">{{c.serialapply_name}}</td>
										<td ng-show="!cols.contains('org_name')" class="">{{c.org_name}}</td>
										<td ng-show="!cols.contains('status_name')" class="">{{c.status_name}}</td>
										<td ng-show="!cols.contains('bill_no')" class="">{{c.bill_no}}</td>
										<td ng-show="!cols.contains('serialapply_object_name')" class="">{{c.serialapply_object_name}}</td>
										<td ng-show="!cols.contains('bounty_desc')" class="">{{c.bounty_desc}}</td>
										<td ng-show="!cols.contains('remark')" class="">{{c.remark}}</td>
									</tr>

								</tbody>
							</table>

						</div>
						<tm-pagination conf="pagination"></tm-pagination>
					</div>
				</section>
				<!--表格显示区域-->

			</div>
		</div>
	</div>
	
<style>
#myModal_detail .modal-dialog{ width:90%; min-height:300px;}
#myModal_detail .modal-body{padding:5px 10px; overflow-y:auto; margin: 0;}
</style>
<script>
$("#myModal_detail").on('show.bs.modal', function (e) {
	var height_val=$(window).height()*0.7;
 	$("#myModal_detail .modal-dialog .modal-body ").css("height",height_val+"px");
 
});
</script>
<!-- Modal -->
<div class="modal fade" id="myModal_detail" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">返利明细</h4>
            </div>
            <div class="modal-body row">
            
				<div ng-include="'/pages/rebate/detail.html'"></div>

            </div>
        </div>
    </div>
</div>
<!-- modal -->
	 
	 
</div>

<form id="export_form" action="rebate/export"  method="post">
	<input type="hidden" name="keys" id="keys" />
	<input type="hidden" name="names" id="names" /> 
	<input type="hidden" name="params" id="params" />
	<input type="hidden" name="search_opt" id="search_opt" /> 
	<input type="hidden" name="file_name" id="file_name" value="返利登记"/>
</form>
